<div class="mt-9 max-w-md">
  <div class="grid grid-cols-1 gap-6">
 
    

<h1>你要做啥子操作？</h1>

<h1>当前提议数量：{getProposalList.length}</h1>
<Link to="withdraw"><MButton title="发起【提币提议】"/></Link>

<Link to="removevoter"><MButton title="发起【撤销议员提议】"/></Link>
<Link to="addvoter"><MButton title="发起【添加议员提议】"/></Link>

<MTextInput  bind:value={proposal_id}  placeholder="输入提议编号后点击【查看提议】"/>
<MButton title="查看提议" on:click={viewProposal}/>
</div>
</div>
<script lang="ts">
import { Router, Route, Link ,useNavigate} from "svelte-navigator";
import { onMount } from 'svelte';
import MButton from '../components/MButton.svelte'
import MTextInput from '../components/MTextInput.svelte'
import {abi} from '../constants'
let proposal_id="";
export let address=""
let getProposalList = []
    
onMount(async () => {
      if (window.ethereum) {
        let web3 = new Web3(window.ethereum);
        let c = new web3.eth.Contract(abi,address,{
            from:"0x948B3c65b89DF0B4894ABE91E6D02FE579834F8F"
          })
          getProposalList  = await c.methods.getProposalList().call()
          console.log({getProposalList})
      }
	  });

 
	const navigate = useNavigate();
const viewProposal = ()=>{
  if(proposal_id===""){
    Swal.fire('请先填写提议编号，才能查看提议')
    return ;
  }

  navigate(`/proposal/${proposal_id}`)
  console.log("进入",proposal_id)
 
}
</script>